<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic"%>

<html:form action="/sistema/compra/modificar" method="post" focus="dataCompra">
	<table class="tbForm">
		<logic:messagesPresent message="false">
		<tr>
			<td colspan="2" class="erro">
				<bean:message key="formulario.informar.erros"/>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="erro">
				<html:messages id="mensagem" message="false" property="falha">
					<bean:write name="mensagem"/>
				</html:messages>
			</td>
		</tr>
		</logic:messagesPresent>
		
		<tr>
			<td valign="top" align="right"><bean:message key="formulario.compra.datacompra"/>:</td>
			<td align="left">
				<html:text property="dataCompra" size="12" maxlength="10"/> <html:img pageKey="sistema.ico.calendario" onclick="displayCalendar(document.forms[0].dataCompra,'dd/mm/yyyy',this)"/>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica('compra/dataCompra.htm')"/>
				<logic:messagesPresent message="false">
					<html:messages id="mensagem" message="false" property="dataCompra">
						<br><span class="erro"><bean:write name="mensagem"/></span>
					</html:messages>
				</logic:messagesPresent>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.compra.numeronotafiscal"/>:</td>
			<td align="left">
				<html:text property="numeroNotaFiscal" size="30" maxlength="30"/>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica('compra/numeroNotaFiscal.htm')"/>
				<logic:messagesPresent message="false">
					<html:messages id="mensagem" message="false" property="numeroNotaFiscal">
						<br><span class="erro"><bean:write name="mensagem"/></span>
					</html:messages>
				</logic:messagesPresent>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.compra.itens"/>:</td>
			<td align="left">
				<html:link action="/sistema/compra/item/listar" paramId="compraId" paramName="compra" paramProperty="compraId">
					<bean:message key="menu.compras.visualizaritens"/>
				</html:link>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica('compra/visualizar-itens.htm')"/>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.compra.finalizada"/>:</td>
			<td align="left">
				<logic:equal name="compra" property="finalizada" value="false"><bean:message key="mensagem.nao"/></logic:equal>
				<logic:equal name="compra" property="finalizada" value="true"><bean:message key="mensagem.sim"/></logic:equal>
			</td>
		</tr>
		<tr>
			<td>
				<html:hidden property="compraId"/>
			</td>
			<td align="left">
				<html:submit><bean:message key="sistema.botao.salvar"/></html:submit>
			</td>
		</tr>
	</table>
</html:form>

<logic:equal name="compra" property="finalizada" value="false">
<table class="tbForm">
	<tr>
		<td align="right">
			<html:form action="/sistema/compra/finalizar">
				<html:hidden name="compra" property="compraId"/>
				<html:submit>
					<bean:message key="formulario.compra.finalizar"/>
				</html:submit>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica('compra/finalizar.htm')" />
			</html:form>
		</td>
	</tr>
</table>
</logic:equal>